package com.sunda.spmsoversea.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.sunda.spmsoversea.entity.OverseaOtherDtl;
import com.sunda.spmsoversea.mapper.OverseaOtherDtlMapper;
import com.sunda.spmsoversea.service.IOverseaOtherDtlService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 海外仓其他出入库明细 服务实现类
 * </p>
 *
 * @author Wayne
 * @since 2021-12-27
 */
@Service
public class OverseaOtherDtlServiceImpl extends ServiceImpl<OverseaOtherDtlMapper, OverseaOtherDtl> implements IOverseaOtherDtlService {

    @Override
    public OverseaOtherDtl getOtherDtl(String uuid, String item) {
        if (StringUtils.isEmpty(uuid) || StringUtils.isEmpty(item)){
            return null;
        }
        QueryWrapper<OverseaOtherDtl> queryWrapper = new QueryWrapper<OverseaOtherDtl>().eq("UUID", uuid).eq("ITEM", item);
        return this.baseMapper.selectOne(queryWrapper);
    }

    @Override
    public List<Map<String, Object>> getOtherDtlList(String uuid) {
        if (StringUtils.isEmpty(uuid)){
            return null;
        }
        return this.baseMapper.getOtherDtlList(uuid);
    }

    @Override
    public List<OverseaOtherDtl> getOverseaOtherDtlList(String uuid) {
        if (StringUtils.isEmpty(uuid)){
            return null;
        }
        QueryWrapper<OverseaOtherDtl> queryWrapper = new QueryWrapper<OverseaOtherDtl>().eq("UUID", uuid);
        return this.baseMapper.selectList(queryWrapper);
    }
}
